# schemas/sys_api_project.py
from pydantic import BaseModel, Field
from datetime import date, datetime


class SysApiProjectBase(BaseModel):
    api_key: str | None = Field(None, description="API KEY")
    api_code: str | None = Field(None, description="API代码")
    api_name: str | None = Field(None, description="API名称")
    api_description: str | None = Field(None, description="API说明")
    invite_code: str | None = Field(None, description="邀请码")
    is_activate: int | None = Field(None, description="启用，1：启用，0：停用")
    disable_date: str | None = Field(None, description="停用时间")
    deletion_mark: int | None = Field(None, description="删除标志，0 表示未删除，1 表示已删除")
    deletion_reason: str | None = Field(None, description="删除原因")
    deletion_date: str | None = Field(None, description="删除日期")
    deletion_by: str | None = Field(None, description="删除者")
    creator_by: str | None = Field(None, description="创建者")
    create_date: datetime = Field(None, description="创建日期")
    # create_date: datetime = Field(..., description="创建日期")
    last_updated_by: str | None = Field(None, description="最后更新者")
    last_updated_date: datetime | None = Field(None, description="最后更新时间")


class SysApiProjectCreate(SysApiProjectBase):
    pass


class SysApiProjectUpdate(SysApiProjectBase):
    pass


class SysApiProject(SysApiProjectBase):
    id: str = Field(..., description="ID")

    class Config:
        from_attributes = True
